import { Component, Input, OnInit } from '@angular/core';
import { SFSchema } from '@delon/form';
import { NzMessageService, NzModalRef } from 'ng-zorro-antd';

@Component({
  selector: 'app-police-edit',
  templateUrl: './police-edit.component.html',
  styles: []
})
export class PoliceEditComponent implements OnInit {
  @Input()type: number; // 0 新增 1 修改
  @Input()param: any; // 参数
  schema: SFSchema = {
    properties: {
      /*bh: {
        type: 'string',
        title: '警务区编号',

      },*/
      policeName: {
        type: 'string',
        title: '警务区名称'
      },
      policeShortName: {
        type: 'string',
        title: '简称'
      },
      parentId: {
        type: 'string',
        title: '上级警务区',
        enum: [
          {label: '福田分局', value: '1'},
          {label: '南园派出所', value: '2'},
        ],
        ui: {
          widget: 'select',
          allowClear: 'true'
        }
      },
      cityId: {
        type: 'string',
        title: '所属行政区',
        enum: [
          {label: '福田区', value: '1'},
          {label: '南园街', value: '2'},
        ],
        ui: {
          widget: 'select',
        }
      },
      status: {
        type: 'string',
        title: '状态',
        enum: [
          {label: '启用', value: true},
          {label: '停用', value: false},
        ],
        ui: {
          widget: 'select',

        }
      },

    },
    required: ['bh','name','fullName', 'status', 'type', 'parentId', 'area']
  }
  submit(data: object): void {
    this.msg.success('新增成功');
    this.modalRef.triggerOk();
  }
  constructor(
    private msg: NzMessageService,
    private modalRef: NzModalRef
  ) { }
  ngOnInit() {
  }

}
